/**************************************************************************************
*
*	Copyright (C) 2009 - 2012 Brent Andrew O. Chua - See LICENSE.txt for more info.
*		
*	Filename	-	RenderEntryRenderTarget.cpp
*
*	Comments	-	See RenderEntryRenderTarget.h
*
**************************************************************************************/

#include "../Include/RenderEntryRenderTarget.h"
#include "../Include/Texture2D.h"
#include "../Include/GraphicsPipeline.h"

namespace Pulse
{
	RenderEntryRenderTarget::RenderEntryRenderTarget( void )
	{
		SetDefault();
	}

	void RenderEntryRenderTarget::SetDefault( void )
	{
		m_bClearBuffers = FALSE;
		m_pDepthStencil = PSX_NULL;
		PSX_ZeroMem( m_pRenderTargets, sizeof(m_pRenderTargets) );
	}

	void RenderEntryRenderTarget::Execute( GraphicsPipeline *pPipeline )
	{
		pPipeline->OMSetDepthStencil( m_pDepthStencil );
		pPipeline->OMSetRenderTarget( PSX_NUM_RENDER_TARGET_SLOT, m_pRenderTargets );
		pPipeline->GetOutputMergerStage()->BindRenderTargets();
	
		if ( m_bClearBuffers )
		{
			pPipeline->OMClearRenderBuffers( &Color( 0, 0, 0, 0 ) );
		}
	}


}